package com.example.quartz.demo.job;

import com.example.quartz.demo.BaseJob;
import com.example.quartz.demo.service.TestMapper;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

public class TestJob  implements BaseJob {
    @Autowired
    private TestMapper testMapper;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        String jobName = context.getJobDetail().getKey().toString().substring(8);
        System.out.println(jobName + "定时任务开启..");
        testMapper.test(jobName);
        System.out.println(jobName + "定时任务结束..");
    }
}
